using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Attributes;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Attributes.DomainAttributes;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Enums;
using System.Collections.Generic;
using System.ComponentModel;

namespace Baci.ArcGIS._SpaceTimePatternMiningTools._TimeSeriesForecasting
{
    /// <summary>
    /// <para>Curve Fit Forecast</para>
    /// <para>Forecasts the values of each location of a space-time cube using curve fitting.</para>
    /// <para>使用曲线拟合预测时空立方体每个位置的值。</para>
    /// </summary>    
    [DisplayName("Curve Fit Forecast")]
    public class CurveFitForecast : AbstractGPProcess
    {
        /// <summary>
        /// 无参构造
        /// </summary>
        public CurveFitForecast()
        {

        }

        /// <summary>
        /// 有参构造
        /// </summary>
        /// <param name="_in_cube">
        /// <para>Input Space Time Cube</para>
        /// <para>The netCDF cube containing the variable to forecast to future time steps. This file must have an .nc file extension and must have been created using the Create Space Time Cube By Aggregating Points, Create Space Time Cube From Defined Locations, or Create Space Time Cube From Multidimensional Raster Layer tool.</para>
        /// <para>包含要预测到未来时间步长的变量的 netCDF 多维数据集。此文件必须具有 .nc 文件扩展名，并且必须已使用通过聚合点创建时空立方体、从定义位置创建时空立方体或从多维栅格图层创建时空立方体工具创建。</para>
        /// </param>
        /// <param name="_analysis_variable">
        /// <para>Analysis Variable</para>
        /// <para>The numeric variable in the netCDF file that will be forecasted to future time steps.</para>
        /// <para>netCDF 文件中将预测到未来时间步长的数值变量。</para>
        /// </param>
        /// <param name="_output_features">
        /// <para>Output Features</para>
        /// <para>The output feature class of all locations in the space-time cube with forecasted values stored as fields. The layer displays the forecast for the final time step and contains pop-ups charts showing the time series and forecasts for each location.</para>
        /// <para>时空立方体中所有位置的输出要素类，其预测值存储为字段。该图层显示最终时间步长的预测，并包含显示每个位置的时间序列和预测的弹出图表。</para>
        /// </param>
        public CurveFitForecast(object _in_cube, object _analysis_variable, object _output_features)
        {
            this._in_cube = _in_cube;
            this._analysis_variable = _analysis_variable;
            this._output_features = _output_features;
        }
        public override string ToolboxName => "Space Time Pattern Mining Tools";

        public override string ToolName => "Curve Fit Forecast";

        public override string CallName => "stpm.CurveFitForecast";

        public override List<string> AcceptEnvironments => ["outputCoordinateSystem"];

        public override object[] ParameterInfo => [_in_cube, _analysis_variable, _output_features, _output_cube, _number_of_time_steps_to_forecast, _curve_type.GetGPValue(), _number_for_validation, _outlier_option.GetGPValue(), _level_of_confidence.GetGPValue(), _maximum_number_of_outliers];

        /// <summary>
        /// <para>Input Space Time Cube</para>
        /// <para>The netCDF cube containing the variable to forecast to future time steps. This file must have an .nc file extension and must have been created using the Create Space Time Cube By Aggregating Points, Create Space Time Cube From Defined Locations, or Create Space Time Cube From Multidimensional Raster Layer tool.</para>
        /// <para>包含要预测到未来时间步长的变量的 netCDF 多维数据集。此文件必须具有 .nc 文件扩展名，并且必须已使用通过聚合点创建时空立方体、从定义位置创建时空立方体或从多维栅格图层创建时空立方体工具创建。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Input Space Time Cube")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _in_cube { get; set; }


        /// <summary>
        /// <para>Analysis Variable</para>
        /// <para>The numeric variable in the netCDF file that will be forecasted to future time steps.</para>
        /// <para>netCDF 文件中将预测到未来时间步长的数值变量。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Analysis Variable")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _analysis_variable { get; set; }


        /// <summary>
        /// <para>Output Features</para>
        /// <para>The output feature class of all locations in the space-time cube with forecasted values stored as fields. The layer displays the forecast for the final time step and contains pop-ups charts showing the time series and forecasts for each location.</para>
        /// <para>时空立方体中所有位置的输出要素类，其预测值存储为字段。该图层显示最终时间步长的预测，并包含显示每个位置的时间序列和预测的弹出图表。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Output Features")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _output_features { get; set; }


        /// <summary>
        /// <para>Output Space Time Cube</para>
        /// <para>A new space-time cube (.nc file) containing the values of the input space-time cube with the forecasted time steps appended. The Visualize Space Time Cube in 3D tool can be used to see all of the observed and forecasted values simultaneously.</para>
        /// <para>一个新的时空立方体（.nc 文件），其中包含附加了预测时间步长的输入时空立方体的值。可视化 3D 时空立方体工具可用于同时查看所有观测值和预测值。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Output Space Time Cube")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public object _output_cube { get; set; } = null;


        /// <summary>
        /// <para>Number of Time Steps to Forecast</para>
        /// <para>A positive integer specifying the number of time steps to forecast. This value cannot be larger than 50 percent of the total time steps in the input space-time cube. The default value is one time step.</para>
        /// <para>一个正整数，指定要预测的时间步长数。此值不能大于输入时空立方体中总时间步长的 50%。默认值为一个时间步长。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Number of Time Steps to Forecast")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public long _number_of_time_steps_to_forecast { get; set; } = 1;


        /// <summary>
        /// <para>Curve Type</para>
        /// <para><xdoc>
        ///   <para>Specifies the curve type that will be used to forecast the values of the input space-time cube.</para>
        ///   <bulletList>
        ///     <bullet_item>Linear—The time series increases or decreases linearly over time.</bullet_item><para/>
        ///     <bullet_item>Parabolic—The time series follows a parabola or quadratic curve over time.</bullet_item><para/>
        ///     <bullet_item>Exponential—The time series increases or decreases exponentially over time.</bullet_item><para/>
        ///     <bullet_item>S-shaped (Gompertz)—The time series increases or decreases following the shape of an S over time.</bullet_item><para/>
        ///     <bullet_item>Auto-detect—All four curve types are run for each location and the model is provided the smallest Validation RMSE. If no time slices are excluded for validation, the model with the smallest Forecast RMSE is used. This is the default.</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>指定将用于预测输入时空立方体值的曲线类型。</para>
        ///   <bulletList>
        ///     <bullet_item>线性 - 时间序列随时间线性增加或减少。</bullet_item><para/>
        ///     <bullet_item>抛物线 - 时间序列随时间推移遵循抛物线或二次曲线。</bullet_item><para/>
        ///     <bullet_item>指数 - 时间序列随时间呈指数增加或减少。</bullet_item><para/>
        ///     <bullet_item>S 形 （Gompertz） - 时间序列随时间推移随 S 形增大或减小。</bullet_item><para/>
        ///     <bullet_item>自动检测 - 针对每个位置运行所有四种曲线类型，并为模型提供最小的验证 RMSE。如果未排除时间片进行验证，则使用具有最小预测 RMSE 的模型。这是默认设置。</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Curve Type")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public _curve_type_value _curve_type { get; set; } = _curve_type_value._AUTO_DETECT;

        public enum _curve_type_value
        {
            /// <summary>
            /// <para>Linear</para>
            /// <para>Linear—The time series increases or decreases linearly over time.</para>
            /// <para>线性 - 时间序列随时间线性增加或减少。</para>
            /// </summary>
            [Description("Linear")]
            [GPEnumValue("LINEAR")]
            _LINEAR,

            /// <summary>
            /// <para>Parabolic</para>
            /// <para>Parabolic—The time series follows a parabola or quadratic curve over time.</para>
            /// <para>抛物线 - 时间序列随时间推移遵循抛物线或二次曲线。</para>
            /// </summary>
            [Description("Parabolic")]
            [GPEnumValue("PARABOLIC")]
            _PARABOLIC,

            /// <summary>
            /// <para>Exponential</para>
            /// <para>Exponential—The time series increases or decreases exponentially over time.</para>
            /// <para>指数 - 时间序列随时间呈指数增加或减少。</para>
            /// </summary>
            [Description("Exponential")]
            [GPEnumValue("EXPONENTIAL")]
            _EXPONENTIAL,

            /// <summary>
            /// <para>S-shaped (Gompertz)</para>
            /// <para>S-shaped (Gompertz)—The time series increases or decreases following the shape of an S over time.</para>
            /// <para>S 形 （Gompertz） - 时间序列随时间推移随 S 形增大或减小。</para>
            /// </summary>
            [Description("S-shaped (Gompertz)")]
            [GPEnumValue("GOMPERTZ")]
            _GOMPERTZ,

            /// <summary>
            /// <para>Auto-detect</para>
            /// <para>Auto-detect—All four curve types are run for each location and the model is provided the smallest Validation RMSE. If no time slices are excluded for validation, the model with the smallest Forecast RMSE is used. This is the default.</para>
            /// <para>自动检测 - 针对每个位置运行所有四种曲线类型，并为模型提供最小的验证 RMSE。如果未排除时间片进行验证，则使用具有最小预测 RMSE 的模型。这是默认设置。</para>
            /// </summary>
            [Description("Auto-detect")]
            [GPEnumValue("AUTO_DETECT")]
            _AUTO_DETECT,

        }

        /// <summary>
        /// <para>Number of Time Steps to Exclude for Validation</para>
        /// <para>The number of time steps at the end of each time series to exclude for validation. The default value is 10 percent (rounded down) of the number of input time steps, and this value cannot be larger than 25 percent of the number of time steps. Provide the value 0 to not exclude any time steps.</para>
        /// <para>每个时间序列末尾要排除以进行验证的时间步数。默认值为输入时间步数的 10%（向下舍入），此值不能大于时间步长数的 25%。提供值 0 以不排除任何时间步长。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Number of Time Steps to Exclude for Validation")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public long? _number_for_validation { get; set; } = null;


        /// <summary>
        /// <para>Outlier Option</para>
        /// <para><xdoc>
        ///   <para>Specifies whether statistically significant time series outliers will be identified.</para>
        ///   <bulletList>
        ///     <bullet_item>None—Outliers will not be identified. This is the default.</bullet_item><para/>
        ///     <bullet_item>Identify outliers—Outliers will be identified using the Generalized ESD test.</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>指定是否识别具有统计显著性的时间序列异常值。</para>
        ///   <bulletList>
        ///     <bullet_item>无—不会识别异常值。这是默认设置。</bullet_item><para/>
        ///     <bullet_item>识别异常值—将使用广义 ESD 检验识别异常值。</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Outlier Option")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public _outlier_option_value _outlier_option { get; set; } = _outlier_option_value._NONE;

        public enum _outlier_option_value
        {
            /// <summary>
            /// <para>None</para>
            /// <para>None—Outliers will not be identified. This is the default.</para>
            /// <para>无—不会识别异常值。这是默认设置。</para>
            /// </summary>
            [Description("None")]
            [GPEnumValue("NONE")]
            _NONE,

            /// <summary>
            /// <para>Identify outliers</para>
            /// <para>Identify outliers—Outliers will be identified using the Generalized ESD test.</para>
            /// <para>识别异常值—将使用广义 ESD 检验识别异常值。</para>
            /// </summary>
            [Description("Identify outliers")]
            [GPEnumValue("IDENTIFY")]
            _IDENTIFY,

        }

        /// <summary>
        /// <para>Level of Confidence</para>
        /// <para><xdoc>
        ///   <para>Specifies the confidence level for the test for time series outliers.</para>
        ///   <bulletList>
        ///     <bullet_item>90%—The confidence level for the test is 90 percent. This is the default.</bullet_item><para/>
        ///     <bullet_item>95%—The confidence level for the test is 95 percent.</bullet_item><para/>
        ///     <bullet_item>99%—The confidence level for the test is 99 percent.</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>指定时间序列异常值检验的置信度。</para>
        ///   <bulletList>
        ///     <bullet_item>90%—检验的置信度为 90%。这是默认设置。</bullet_item><para/>
        ///     <bullet_item>95%—检验的置信水平为 95%。</bullet_item><para/>
        ///     <bullet_item>99%—检验的置信水平为 99%。</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Level of Confidence")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public _level_of_confidence_value _level_of_confidence { get; set; } = _level_of_confidence_value.value0;

        public enum _level_of_confidence_value
        {
            /// <summary>
            /// <para>90%</para>
            /// <para>90%—The confidence level for the test is 90 percent. This is the default.</para>
            /// <para>90%—检验的置信度为 90%。这是默认设置。</para>
            /// </summary>
            [Description("90%")]
            [GPEnumValue("90%")]
            value0,

            /// <summary>
            /// <para>95%</para>
            /// <para>95%—The confidence level for the test is 95 percent.</para>
            /// <para>95%—检验的置信水平为 95%。</para>
            /// </summary>
            [Description("95%")]
            [GPEnumValue("95%")]
            value1,

            /// <summary>
            /// <para>99%</para>
            /// <para>99%—The confidence level for the test is 99 percent.</para>
            /// <para>99%—检验的置信水平为 99%。</para>
            /// </summary>
            [Description("99%")]
            [GPEnumValue("99%")]
            value2,

        }

        /// <summary>
        /// <para>Maximum Number of Outliers</para>
        /// <para>The maximum number of time steps that can be declared outliers for each location. The default value corresponds to 5 percent (rounded down) of the number of time steps of the input space-time cube (a value of at least 1 will always be used). This value cannot exceed 20 percent of the number of time steps.</para>
        /// <para>每个位置可以声明为异常值的最大时间步数。默认值对应于输入时空立方体的时间步长数的 5%（向下舍入）（将始终使用至少 1 的值）。此值不能超过时间步长数的 20%。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Maximum Number of Outliers")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public long? _maximum_number_of_outliers { get; set; } = null;


        public CurveFitForecast SetEnv(object outputCoordinateSystem = null)
        {
            base.SetEnv(outputCoordinateSystem: outputCoordinateSystem);
            return this;
        }

    }

}